package com.basksoft.baskreport.demo.dataset;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.math.RandomUtils;

import com.basksoft.report.core.model.dataset.BeanDataset;
import com.basksoft.report.core.model.dataset.impl.BeanContext;
import com.basksoft.report.core.model.dataset.impl.Field;
import com.basksoft.report.core.model.dataset.impl.FieldType;

public class TasksDataset extends BeanDataset {
	private static int number = 1;

	@Override
	public List<?> getData(BeanContext context) {
		List<Map<String,Object>> datas=new ArrayList<Map<String,Object>>();
		for (int i=0; i<10; i++) {
			Map<String, Object> data = new HashMap<String, Object>();
			data.put("host", "主机"+number);
			number++;
			data.put("number", RandomUtils.nextInt(30));
			datas.add(data);
		}
		return datas;
	}

	@Override
	public List<String> getDependCells() {
		return null;
	}

	@Override
	protected String name() {
		return "主机执行任务";
	}

	@Override
	public List<Field> getFields() {
		List<Field> fields = new ArrayList<Field>();
		fields.add(new Field("host", FieldType.String));
		fields.add(new Field("number", FieldType.Integer));
		return fields;
	}

}
